<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/vue.js"></script>
</head>
<body>
  <div id="app"></div>
</body>
<script>
    Vue.filter("myReverse",function (value) {
        return value.split("").reverse().join("");
    });


    var App = {
        data:function () {
          return {
              price:0,
              msg:"hello filter"
          }
        },
        filters:{
            //声明一个过滤器
            myCurrency:function (value) {
                return "￥"+value;
            }
        },
        //使用过滤器{{数据|过滤器名字}}
        template:"<div>" +
        "<input type='text' v-model='price'>" +
        "<h3>{{price|myCurrency}}</h3>" +
        "<h4>{{msg|myReverse}}</h4>" +
        "</div>"
    };

    new Vue({
        el:"#app",
        data:function () {
            return {}
        },
        //挂子
        components:{
            App:App
        },
        //用子
        template:"<App></App>"
    });
</script>
</html>